Skip to content

docs(axum-http-server): fix the extractor docs: the error status is 200, not 500 - #2995

Open
josecelano-bot wants to merge 1 commit into
torrust:developfrom
josecelano-bot:extractor-docs-status-200
Open

josecelano-bot wants to merge 1 commit into
torrust:developfrom
josecelano-bot:extractor-docs-status-200

Conversation

@josecelano-bot

Copy link
Copy Markdown
Contributor

Summary

The module docs of the announce and scrape request extractors say the bencoded error response has HTTP status 500 when the query parameters are missing or invalid. The real status is 200 OK: both extractors return (StatusCode::OK, error.write()), and the contract tests assert 200 (for example assert_missing_query_params_for_announce_request_error_response). BEP 3 sets no status code for errors. This PR makes the two docs say 200 OK, in the wording of authentication_key.rs.

Where it was found: manual runs and tests in the sub-issues SI-3 and SI-4 of EPIC #2912 returned 200 for malformed requests, which contradicted these docs. No other extractor or handler doc in packages/axum-http-server has the mistake.

Files

  • packages/axum-http-server/src/v1/extractors/announce_request.rs (doc comment only)
  • packages/axum-http-server/src/v1/extractors/scrape_request.rs (doc comment only)

Validation

contrib/dev-tools/git/hooks/pre-commit.sh passed: linter all, rustfmt, cargo machete and the doc tests. No code changes.

…00, not 500

The announce and scrape request extractors answer missing or invalid query parameters with a bencoded failure reason and HTTP status 200 OK (StatusCode::OK), as the authentication key extractor does. Their module docs said 500.
@josecelano

Copy link
Copy Markdown
Member

ACK e723266

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the documentation-only correction to the announce and scrape error-status descriptions.

No open issues 🎉

What changed in this PR

This documentation-only PR corrects the HTTP error status documented by the announce and scrape request extractors in axum-http-server, aligning it with existing behavior.

Changes:

  • Replaces 500 with 200 OK for bencoded errors caused by missing or invalid query parameters.
  • Leaves runtime behavior and tests unchanged.
File Description
packages/​axum-http-server/​src/​v1/​extractors/​scrape_request.rs Corrects the documented scrape error status to 200 OK.
packages/​axum-http-server/​src/​v1/​extractors/​announce_request.rs Corrects the documented announce error status to 200 OK.

Review effort: Balanced

@josecelano

Copy link
Copy Markdown
Member

ACK e723266

This branch was previously deployed

1 inactive deployment
coverage — e723266c Deployed Nov 22, 2026 by josecelano-bot via Generate Coverage Report #3380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants